package com.own.app;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.apache.wicket.Component;
import org.apache.wicket.Page;
import org.apache.wicket.RestartResponseAtInterceptPageException;
import org.apache.wicket.Session;

import org.apache.wicket.authorization.Action;
import org.apache.wicket.authorization.IAuthorizationStrategy;
import org.apache.wicket.authroles.authentication.AbstractAuthenticatedWebSession;
import org.apache.wicket.authroles.authentication.AuthenticatedWebApplication;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.protocol.http.WebApplication;
import org.apache.wicket.request.Request;
import org.apache.wicket.request.Response;
import org.apache.wicket.util.time.Duration;

import com.own.core.html.component.OwnResourceLoader;
import com.own.core.operation.DbOperation;
import com.own.pages.Main;
import com.own.pages.login.Login;

public class OwnApp extends AuthenticatedWebApplication {

	

	public Class<? extends Page> getHomePage() {
		
		return Main.class;
	}

	@Override
	public final OwnSession newSession(Request request, Response response) {
		return new OwnSession(request);
	}

	protected void init() {
		super.init();

//		getResourceSettings().getStringResourceLoaders().clear();
		getResourceSettings().getStringResourceLoaders().add(
				new OwnResourceLoader());

		getResourceSettings().setResourcePollFrequency(Duration.seconds(60));
		getPageSettings().setVersionPagesByDefault(false);
	}

	@Override
	protected Class<? extends AbstractAuthenticatedWebSession> getWebSessionClass() {
		return OwnSession.class;
	}

	@Override
	protected Class<? extends WebPage> getSignInPageClass() {

		return Login.class;
	}
 
}